<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * This file contains the PDODB_Listener interface.
 *
 * PHP version 5
 *
 * This file is part of PEAR::PDODB - A database abstraction layer for PHP5 built
 * using PDO. PHP version 5.1+ is recommended.
 *
 * PEAR::PDODB is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * PEAR::PDODB is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with PEAR::PDODB. If not, see <http://www.gnu.org/licenses/>.
 *
 * @package     PDODB
 * @category    Database
 * @author      Michael J. I. Jackson <mjijackson@gmail.com>
 * @copyright   2007 Michael J. I. Jackson
 * @license     http://www.gnu.org/licenses/lgpl-3.0.txt GNU LGPL 3.0
 * @version     SVN: $Id: Listener.php 2 2007-11-27 17:20:29Z mjijackson $
 * @link        http://pear.php.net/packages/PDODB
 */

/**
 * An interface for PDODB event listeners.
 *
 * @package     PDODB
 * @category    Database
 * @author      Michael J. I. Jackson <mjijackson@gmail.com>
 */
interface PDODB_Listener
{

    /**
     * Fired in {@link PDODB_Connection::raiseWarning()} immediately after a new
     * warning has been raised on the connection. Can be used together with
     * {@link PDODB::ATTR_SILENT_WARNINGS} to log connection warnings.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function onWarning(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::connect()} immediately before establishing
     * a database connection.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function preConnect(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::connect()} immediately after establishing
     * a database connection.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function postConnect(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::disconnect()} immediately before
     * disconnecting from the database.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function preDisconnect(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::disconnect()} immediately after
     * disconnecting from the database.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function postDisconnect(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::query()} immediately before issuing a query
     * to the database.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function preQuery(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::query()} immediately after issuing a query
     * to the database.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function postQuery(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::exec()} immediately before executing a
     * query on the database.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function preExec(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::exec()} immediately after executing a
     * query on the database.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function postExec(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::prepare()} immediately before preparing a
     * prepared statement.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function prePrepare(PDODB_Connection $conn);

    /**
     * Fired in {@link PDODB_Connection::prepare()} immediately after preparing a
     * prepared statement.
     *
     * @param   PDODB_Connection    $conn   The connection that triggered this event
     * @return  void
     * @access  public
     */
    public function postPrepare(PDODB_Connection $conn);

}

?>
